import request from '@/utils/request'

export function softwareVersion(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/softwareVersio' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/softwareVersio' + url,
      method: method,
      params
    })
  }
}
export function equipUpgradeTask(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/equipUpgradeTask' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/equipUpgradeTask' + url,
      method: method,
      params
    })
  }
}
export function upgrade(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/upgrade' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/upgrade' + url,
      method: method,
      params
    })
  }
}
export function equipUpgradeLog(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/equipUpgradeLog' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/equipUpgradeLog' + url,
      method: method,
      params,
    })
  }
}

export function exportEquip(params) {
  return request({
    url: '/api/equip/upgrade/log/export/version/notmatch',
    method: 'get',
    params,
    responseType: 'blob',
  })
}
export function exportFail(params) {
  return request({
    url: '/api/equip/operate/log/export/fail',
    method: 'get',
    params,
    responseType: 'blob',
  })
}
export function exportVersionFile(data) {
  return request({
    url: '/api/equip/version/list/export',
    method: 'post',
    data,
    responseType: 'blob',
  })
}
export function partType(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/partType' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/partType' + url,
      method: method,
      params
    })
  }
}
export function softwareVersions(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/softwareVersion' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/softwareVersion' + url,
      method: method,
      params
    })
  }
}
